import api from '../../api';
import { message } from 'antd';
export default {
  namespace: 'industryM',
  state: {},
  effects: {
    *getIndustry({ payload, callback }, { call, put }) {
      const response = yield call(api.getIndustry, payload);
      const data = [
        {
          title: '1',
          value: '1',
          children: [
            {
              title: '11',
              value: '11',
              children: [
                {
                  title: '111',
                  value: '111',
                },
                {
                  title: '112',
                  value: '112',
                },
              ],
            },
            {
              title: '12',
              value: '12',
              children: [
                {
                  title: '121',
                  value: '121',
                },
                {
                  title: '122',
                  value: '122',
                },
              ],
            },
          ],
        },
        {
          title: '2',
          value: '2',
          children: [
            {
              title: '21',
              value: '21',
              children: [
                {
                  title: '211',
                  value: '211',
                },
                {
                  title: '212',
                  value: '212',
                },
              ],
            },
            {
              title: '22',
              value: '22',
              children: [
                {
                  title: '221',
                  value: '221',
                },
                {
                  title: '222',
                  value: '222',
                },
              ],
            },
          ],
        },
      ];
      const data2 = [
        {
          title: 1,
          value: 1,
        },
        {
          title: 1,
          value: 1,
        },
        {
          title: 1,
          value: 1,
        },
        {
          title: 1,
          value: 1,
        },
      ];
      // callback(data)
      if (response && response.code == 0) {
        callback(response.data);
      } else {
        callback();
        message.error(response.msg || '查询行业失败');
      }
    },
  },

  reducers: {
    setState(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
